#pragma once

#include"Singleton.h"
#include"Task.h"
#include<unordered_set>
#include<mutex>

namespace tmms
{
    namespace base
    {
        class TaskMgr:public NonCopyable
        {
        public:
            TaskMgr() = default;
            ~TaskMgr() = default;

            void onWork();
            bool Add(TaskPtr &task);
            bool Del(TaskPtr &task);
            
        private:
            std::unordered_set<TaskPtr> tasks_;
            std::mutex mtx_;
        };
        
    }
    #define sTaskMgr tmms::base::Singleton<tmms::base::TaskMgr>::Instance()
}